package com.easybbs.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;


/**
 * @Author: yudaxian
 * @Description: TODO
 * @DateTime: 2024/10/21 16:09
 **/
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum UserRoleEnum {
    ADMIN("admin", "管理员"),
    USER("user", "普通用户"),
    VIP("vip", "VIP"),
    BANNED("banned", "封禁用户"),
    ;

    private String roleName;

    private String desc;

    public static UserRoleEnum getEnumByName(String roleName) {
        for (UserRoleEnum role : UserRoleEnum.values()) {
            if (role.getRoleName().equals(roleName)) {
                return role;
            }
        }
        return null;
    }
}
